package com.kiln.juxingqs.ui

import android.content.Intent
import android.graphics.Color
import android.view.Gravity
import android.view.View
import androidx.lifecycle.Observer
import client.global.commlib.toast.toast
import com.bigkoo.pickerview.builder.TimePickerBuilder
import com.bigkoo.pickerview.view.TimePickerView
import com.blankj.utilcode.util.TimeUtils
import com.blankj.utilcode.util.ToastUtils
import com.kiln.juxingqs.BaseMiddleActivity
import com.kiln.juxingqs.R
import com.kiln.juxingqs.databinding.ActivitySetbank3Binding
import com.kiln.juxingqs.ui.vm.SetBank3ViewModel
import java.text.SimpleDateFormat
import java.util.*

/**
 * 绑定银行卡
 */
class CreateBank3Activity :
    BaseMiddleActivity<SetBank3ViewModel, ActivitySetbank3Binding>() {

    private var dateFormat: SimpleDateFormat? = null

    override fun getLayout(): Int {
        return R.layout.activity_setbank3
    }

    override fun initViewModel(): SetBank3ViewModel = createViewModel()

    override fun initView() {
        binding.event = this
        binding.vm = viewModel
        dateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm")
    }

    override fun initData() {

    }

    override fun observerUI() {
        viewModel.callBind.observe(this, Observer {
            it?.apply {
                if (isSuccess) {
                    toast("操作成功")
                    startActivity(Intent(this@CreateBank3Activity, Bank3CodeActivity::class.java).apply {
                        putExtra("apply_id", it.data?.apply_id)
                    })
                    finish()
                }
            }
        })
    }

    fun onCheckCType(type: Int) {
        when (type) {
            0 -> {
                binding.llXyk.visibility = View.GONE
                viewModel.c_type.value = 0
            }
            1 -> {
                binding.llXyk.visibility = View.VISIBLE
                viewModel.c_type.value = 1
            }
        }
    }

    fun ok() {
//        if (viewModel.num.value == null || viewModel.txType.value!! < 0) {//
//            toast("所有不得为空")
//            return
//        }
//        viewModel.ok()
    }


}